#pragma once
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
struct TreeNode {
	int val;
	struct TreeNode* left;
	struct TreeNode* right;
};
bool issametree(struct TreeNode* left, struct TreeNode* right) {

    if (left == NULL && right != NULL)
        return false;
    if (right == NULL && left != NULL)
        return false;
    if (right == NULL && left == NULL)
        return true;
    if (left->val != right->val)
        return false;
    return issametree(left->left, right->left) && issametree(left->right, right->right);
}

bool isSubtree(struct TreeNode* root, struct TreeNode* subRoot) {
    if (issametree(root, subRoot))
        return true;
    else
    {
        return issametree(root->left, subRoot) || issametree(root->right, subRoot);
    }
}